package com.xb.controller;

import com.xb.entity.LoginInfo;
import com.xb.mapper.LoginInfoMapper;
import com.xb.service.ILoginInfoService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Controller
 * /api/loginInfo
 */
@RestController
@RequestMapping("/api/loginInfo")
public class LoginInfoController {
    @Autowired
    private ILoginInfoService loginInfoService;
    @Autowired
    private LoginInfoMapper loginInfoMapper;

    @RequestMapping("/page")
    @RequiresPermissions("system:loginInfo:page")
    public Object findPage(LoginInfo loginInfo, @RequestParam(value = "page", defaultValue = "1") Integer page,
                           @RequestParam(value = "limit", defaultValue = "10") Integer limit) {
        return loginInfoService.selectLoginInfoList(loginInfo, page, limit);
    }

    @PostMapping("/export")
    public List<LoginInfo> export(LoginInfo loginInfo) {
        List<LoginInfo> loginInfos = loginInfoMapper.selectLoginInfoList(loginInfo);
        System.out.println(loginInfos);
        return loginInfos;
    }


}
